<%@ page language="java" pageEncoding="GBK" %>
<%@ page contentType="text/html; charset=GBK" language="java"%>
<%@ page import="com.hd123.rumba.request.Dictionary"%>
<%@ page import="com.hd123.rumba.user.CRole"%>
<%@ page import="com.hd123.rumba.user.IRoleDomain"%>
<%
Dictionary dd = (Dictionary) request.getAttribute("dd");

String viewName = (String) dd.get("viewName");
%>

<script language=javascript>
function buildQuery(qry, codeLike) {
	qry.service = "<%=viewName%>.queryList";
	qry.addFrom("<%=IRoleDomain.class.getName()%>", "r");
	qry.addSelect("r.role.uuid", "uuid");
	qry.addSelect("r.role.code", "code");
	qry.addSelect("r.role.name", "name");
	var where = new RSCE();
	where.operator = RSCE.VALUE_OPERATOR_AND;
	where.append(RSCE.cond("r.role.state <> ?", <%=String.valueOf(CRole.VALUE_STATE_DELETED)%>));
	if (isDefined(codeLike) && trimString(codeLike) != "")
		where.append(RSCE.cond("r.role.code like ?", codeLike, RSCE.WC_RIGHT));
	qry.setWhere(where);
	qry.addOrder("r.role.code", RQuery.ORDER_ASC);
}

function buildGrid(grid) {
	grid.addColumnDef(new RQColumnDef({caption: "uuid", 
		fieldName: "uuid", dataType: RQColumnDef.DT_TEXT, hidden: true}));
	grid.addColumnDef(new RQColumnDef({caption: "<%=CRole.CAPTION_CODE%>", 
		fieldName: "code", dataType: RQColumnDef.DT_TEXT}));
	grid.addColumnDef(new RQColumnDef({caption: "<%=CRole.CAPTION_NAME%>", 
		fieldName: "name", dataType: RQColumnDef.DT_TEXT}));
}
</script>